<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			*{
				padding: 0;
				margin: 0;
			}
			body{
				position: relative;
			}
			#aaa{
				width: 100px;
				height: 100px;
				background: #ccc;
				position: absolute;
				left: 0;
				top: 0;
			}
		</style>
	</head>
	<body>
		<div id="aaa">
			
		</div>
	</body>
</html>
<script type="text/javascript">
	var aaa = document.getElementById('aaa')
	aaa.style.position = 'absolute'
	aaa.style.left = '0'
	aaa.style.top = '0'
	// 定位的样式必须写在js里，不然没用，不知道为什么
	
	var v = 1;
	var timer = setInterval(function(){
		v += 2		
		aaa.style.left = parseInt(aaa.style.left) + v + 'px'
		if ( parseInt(aaa.style.left)>500 ) {
			clearInterval(timer)
		}
		console.log(v)
	},10)
</script>